/**
 * 
 */
package com.thor.palmmall.rest.sales.input.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.sales.input.ASalesInputLine;
import com.thor.palmmall.spi.sales.input.SSalesInputLine;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class ASalesInputLineConverter implements Converter<SSalesInputLine, ASalesInputLine> {

  public static ASalesInputLineConverter getInstance() {
    if (instance == null)
      instance = new ASalesInputLineConverter();
    return instance;
  }

  private static ASalesInputLineConverter instance;

  private ASalesInputLineConverter() {
  }

  @Override
  public ASalesInputLine convert(SSalesInputLine source) {
    if (source == null) {
      return null;
    }
    ASalesInputLine target = new ASalesInputLine();
    target.setPayment(UCN.newInstance(source.getPayment()));
    target.setTotal(source.getTotal());
    return target;
  }

}
